Skip to content

Conversation

@abobov
Copy link
Contributor

@abobov abobov commented Oct 31, 2025

PR Description

The existing diff parser incorrectly treated subsequent lines beginning with --- as filename headers while processing hunks. This caused corruption when dashed lines appeared within diffs themselves.

Restrict filename detection to only occur between hunks.

This repository https://github.com/abobov/lazygit-fixup-issue demonstrates the issue:

  • clone repository
  • run git reset --soft HEAD~
  • try <c-f> Find base commit for fixup
  • fatal: no such path ... error

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@abobov abobov force-pushed the fix-diff-hunk-boundaries-parsing branch 2 times, most recently from 186d5f0 to 29eb391 Compare November 1, 2025 00:58
@stefanhaller stefanhaller added blocks-release Must be addressed before we can cut the next release bug Something isn't working labels Nov 1, 2025
The existing diff parser incorrectly treated subsequent lines beginning
with "---" as filename headers while processing hunks.  This caused
corruption when dashed lines appeared within diffs themselves.

Restrict filename detection to only occur between hunks.
@stefanhaller stefanhaller force-pushed the fix-diff-hunk-boundaries-parsing branch from 29eb391 to 4c4929a Compare November 1, 2025 08:40
@stefanhaller
Copy link
Collaborator

Looks great, thanks for fixing this.

@stefanhaller stefanhaller merged commit 48c1db6 into jesseduffield:master Nov 1, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocks-release Must be addressed before we can cut the next release bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants